package com.missilike.admin.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.missilike.biz.IMilRecommendRegisterService;
import com.missilike.core.result.CommonResult;
import com.missilike.core.utils.ResultUtils;
import com.missilike.domain.response.MilAccountInfo;
import com.missilike.domain.response.MilRecommendInfo;
import com.missilike.repository.entity.MilRecommendRegister;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 推荐关系 前端控制器
 * </p>
 *
 * @author kin
 * @since 2018-12-15
 */
@RestController
@RequestMapping("/api/mil/recommend")
public class MilRecommendRegisterController {

    private final IMilRecommendRegisterService milRecommendRegisterService;

    @Autowired
    public MilRecommendRegisterController(IMilRecommendRegisterService milRecommendRegisterService) {
        this.milRecommendRegisterService = milRecommendRegisterService;
    }

    @RequestMapping(value = "page", method = RequestMethod.GET)
    public CommonResult list(@RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum,
                             @RequestParam(value = "pageSize", required = false, defaultValue = "20") int pageSize,
                             @RequestParam(value = "applyAccount",required = false) String applyAccount,
                             @RequestParam(value = "recommendAccount",required = false) String recommendAccount) {
        IPage<MilRecommendInfo> accountList = milRecommendRegisterService.getList(new Page<>(pageNum, pageSize), applyAccount, recommendAccount);
        return ResultUtils.ok(accountList);
    }
}
